# $Id: PKGBUILD 61009 2011-12-20 13:44:17Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>

pkgname=arm-wince-cegcc-newlib
pkgver=0.59.1
pkgrel=1
_prefix=/opt/cegcc
pkgdesc="CE GCC bundle - cross compilation tools for WinCE"
arch=('any')
license=('GPL')
options=('!libtool' '!strip')
url="http://cegcc.sf.net"
depends=()
makedepends=('arm-wince-cegcc-gcc-base' 'arm-wince-cegcc-binutils' 'arm-wince-cegcc-w32api')
groups=('cegcc')
source=(http://arch.p5n.pp.ru/~sergej/dl/cegcc-$pkgver.tar.bz2)
md5sums=('5e3c1098abdf8e5db2a3518ee3578b4b')

build() {
  cd $srcdir/cegcc/src/

  mkdir -p build-newlib
  cd build-newlib

  export PATH=$_prefix/bin:$PATH
  export TARGET=arm-wince-cegcc
  unset CFLAGS
  unset LDFLAGS
  unset MAKEFLAGS

  ../newlib/configure \
	--target=arm-wince-cegcc \
	--prefix=$_prefix

  make || (cd etc && make) && make
  mkdir -p $pkgdir/opt/cegcc/arm-wince-cegcc/lib/
  make DESTDIR=$pkgdir install
  find $pkgdir/${_prefix} -type f -name \*.a -exec arm-wince-cegcc-ranlib {} \;
}
